#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>

#include "MISC.h"

#ifndef _BONN_SHUTTER_
#define _BONN_SHUTTER_

/*
	Shutter open/close 低电位时快门打开,高电位时快门关闭
	Blade-A: 为0时表示快门A打开
	Blade-B: 为0时表示快门B打开
	Error: 为0时表示出现错误,为1时正常
*/

//	open bonn-shutter
void bonn_shutter_open( uint32_t *gpio_reg, 
						uint32_t *gpio_in_reg );

// close bonn-shutter
void bonn_shutter_close( uint32_t *gpio_reg, 
						 uint32_t *gpio_in_reg );

// report bonn-shutter status
void bonn_shutter_report_status( uint32_t *gpio_in_reg );

// exposure for exp_t_sec seconds
void bonn_shutter_exposure( uint32_t *gpio_reg, 
							uint32_t *gpio_in_reg,
							float exp_t_sec );

// exposure for exp_t_sec seconds, but can be aborted before exposure ends, added@2024-01-01
void bonn_shutter_exposure_with_abort( 	uint32_t *gpio_reg, 
										uint32_t *gpio_in_reg,
										float exp_t_sec );

int bonn_shutter_is_open( uint32_t *gpio_in_reg );


// @2022-06-23：增加控制Thorlabs快门的函数
void thorlabs_shutter_open( uint32_t *gpio_reg,
							uint32_t *gpio_in_reg );

void thorlabs_shutter_close( uint32_t *gpio_reg,
							 uint32_t *gpio_in_reg );

void thorlabs_shutter_exposure( uint32_t *gpio_reg,
								uint32_t *gpio_in_reg,
								float exp_t_sec );
#endif	// _BONN_SHUTTER_
